﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace PRO_DOCS.DocumentManagementSystem.ADMIN.WIN.Configurations.Documents.DocumentTypes
{
    public partial class DocumentTypesIndecies : BLL.WIN.Templates.DevxConfigurationUserControlTemplate
    {
        public void LOAD_ALL_DOCUMENT_TYPE_DYNAMIC_INDECIES(Int64 aRCHIVE_DOCUMENT_TYPE_ID)
        {
            RESET_ALL_INPUTS();

            CURRENT_SELECTED_ARCHIVE_DOCUMENT_TYPE = (from indecies in PRO_DOCSDatabaseDataContext.ARCHIVE_DOCUMENT_TYPEs
                                                      where indecies.ARCHIVE_DOCUMENT_TYPE_ID.Equals(aRCHIVE_DOCUMENT_TYPE_ID)
                                                      select indecies).FirstOrDefault();

            List<DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX> aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDECIES = CURRENT_SELECTED_ARCHIVE_DOCUMENT_TYPE.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEXes.ToList();

            gridControl1.DataSource = aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDECIES;


        }

        #region Custom Properties

        /// <summary>
        /// Sets a value indicating whether [show max length].
        /// </summary>
        /// <value><c>true</c> if [show max length]; otherwise, <c>false</c>.</value>
        private bool ShowMaxLength
        {
            set
            {
                lblMaxLength.Visible = value;
                txtMaxLength.Visible = value;
            }
        }
        /// <summary>
        /// Sets a value indicating whether [show list item adjustment].
        /// </summary>
        /// <value>
        /// 	<c>true</c> if [show list item adjustment]; otherwise, <c>false</c>.
        /// </value>
        private bool ShowListItemAdjustment
        {
            set
            {
                dtePickerDefaultValue.Visible = false;
                comboDefaultValue.Visible = value && SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.OptionalValue);
                //lblDefaultValue.Visible = comboDefaultValue.Visible;
                txtDefaultValue.Visible = value && SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Multiselect);
                txtDefaultValue.Properties.ReadOnly = true;
                numericDefaultValue.Visible = false;

                if (value)
                {
                    comboDefaultValue.Properties.Items.Clear();
                    comboList.Properties.Items.Clear();
                }

                lblList.Visible = value;
                comboList.Visible = value;
                btnAdjustList.Visible = value;
            }
        }
        /// <summary>
        /// Sets a value indicating whether [show country].
        /// </summary>
        /// <value><c>true</c> if [show country]; otherwise, <c>false</c>.</value>
        private bool ShowCountry
        {
            set
            {
                dtePickerDefaultValue.Visible = false;

                comboDefaultValue.Visible = value;
                //lblDefaultValue.Visible = comboDefaultValue.Visible;
                txtDefaultValue.Visible = false;
                txtDefaultValue.Properties.ReadOnly = false;
                numericDefaultValue.Visible = false;
                if (value)
                {

                    comboDefaultValue.Properties.Items.Clear();
                    DAL.AppCode.Countries.LoadAllCountriesToComboBox(comboDefaultValue);
                    comboDefaultValue.SelectedIndex = -1;
                }
            }
        }
        /// <summary>
        /// Sets a value indicating whether [show nationality].
        /// </summary>
        /// <value><c>true</c> if [show nationality]; otherwise, <c>false</c>.</value>
        private bool ShowNationality
        {
            set
            {
                dtePickerDefaultValue.Visible = false;
                comboDefaultValue.Visible = value;
                //lblDefaultValue.Visible = comboDefaultValue.Visible;
                txtDefaultValue.Visible = false;
                txtDefaultValue.Properties.ReadOnly = false;
                numericDefaultValue.Visible = false;
                if (value)
                {
                    comboDefaultValue.Properties.Items.Clear();
                    DAL.AppCode.Countries.LoadAllNationalitiesToComboBox(comboDefaultValue);
                    comboDefaultValue.SelectedIndex = -1;
                }
            }
        }
        /// <summary>
        /// Sets a value indicating whether [show numeric].
        /// </summary>
        /// <value><c>true</c> if [show numeric]; otherwise, <c>false</c>.</value>
        private bool ShowNumeric
        {
            set
            {
                dtePickerDefaultValue.Visible = false;
                comboDefaultValue.Visible = false;

                txtDefaultValue.Properties.ReadOnly = false;
                txtDefaultValue.Visible = false;
                numericDefaultValue.Visible = value;
                //lblDefaultValue.Visible = numericDefaultValue.Visible;

                if (value)
                {
                    numericDefaultValue.Properties.Mask.EditMask = (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Decimal)) ? "f" : "f0";
                    numericDefaultValue.Value = 0;
                }
            }
        }
        /// <summary>
        /// Sets a value indicating whether [show decimal].
        /// </summary>
        /// <value><c>true</c> if [show decimal]; otherwise, <c>false</c>.</value>
        private bool ShowDecimal
        {
            set
            {
                dtePickerDefaultValue.Visible = false;
                comboDefaultValue.Visible = false;
                txtDefaultValue.Visible = false;
                txtDefaultValue.Properties.ReadOnly = false;
                numericDefaultValue.Visible = value;
                //lblDefaultValue.Visible = numericDefaultValue.Visible;

                if (value)
                {
                    numericDefaultValue.Properties.Mask.EditMask = (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Decimal)) ? "f" : "f0";
                    numericDefaultValue.Value = 0;
                }
            }
        }
        /// <summary>
        /// Sets a value indicating whether [show text].
        /// </summary>
        /// <value><c>true</c> if [show text]; otherwise, <c>false</c>.</value>
        private bool ShowText
        {
            set
            {
                dtePickerDefaultValue.Visible = false;
                comboDefaultValue.Visible = false;
                txtDefaultValue.Visible = value;
                txtDefaultValue.Properties.ReadOnly = false;
                //lblDefaultValue.Visible = txtDefaultValue.Visible;
                numericDefaultValue.Visible = false;
                if (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Text))
                {
                    ShowMaxLength = true;
                    txtMaxLength.Text = "50";
                }
                else
                {
                    ShowMaxLength = false;
                }

                if (value)
                {
                    txtDefaultValue.Text = String.Empty;
                }
            }
        }
        /// <summary>
        /// Sets a value indicating whether [show date time].
        /// </summary>
        /// <value><c>true</c> if [show date time]; otherwise, <c>false</c>.</value>
        private bool ShowDateTime
        {
            set
            {
                dtePickerDefaultValue.Visible = false;
                //lblDefaultValue.Visible = dtePickerDefaultValue.Visible;
                comboDefaultValue.Visible = false;
                txtDefaultValue.Visible = false;
                txtDefaultValue.Properties.ReadOnly = false;
                numericDefaultValue.Visible = false;
                chkNoDate.Visible = value;
                chkCurrentDate.Visible = value;
                tmepkrDefaultTimePicker.Visible = false;
                if (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Date))
                {
                    dtePickerDefaultValue.Visible = true;
                    this.dtePickerDefaultValue.Size = new System.Drawing.Size(200, 20);
                }
                else if (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Time))
                {
                    tmepkrDefaultTimePicker.Visible = true;
                    tmepkrDefaultTimePicker.Size = new System.Drawing.Size(98, 20);
                }

                if (value)
                {

                }
            }
        }

        /// <summary>
        /// Sets a value indicating whether [show boolean].
        /// </summary>
        /// <value><c>true</c> if [show boolean]; otherwise, <c>false</c>.</value>
        private bool ShowBoolean
        {
            set
            {
                dtePickerDefaultValue.Visible = false;
                comboDefaultValue.Visible = value;
                //lblDefaultValue.Visible = comboDefaultValue.Visible;
                txtDefaultValue.Visible = false;
                txtDefaultValue.Properties.ReadOnly = false;
                numericDefaultValue.Visible = false;


                lblFalseValue.Visible = value;
                txtFalseValue.Visible = value;
                lblTrueLabel.Visible = value;
                txtTrueValue.Visible = value;

                if (value)
                {
                    comboDefaultValue.Properties.Items.Clear();

                    comboDefaultValue.Properties.Items.Add(txtTrueValue.Text);
                    comboDefaultValue.Properties.Items.Add(txtFalseValue.Text);

                    comboDefaultValue.SelectedIndex = 0;

                }

            }
        }

        #endregion

        /// <summary>
        /// Gets or sets the selection list.
        /// </summary>
        /// <value>The selection list.</value>
        /// 
        public List<OPTIONAL_MULTIPLE_CHOICES_SELECTION> _cURRENT_CHOICES_LIST;
        public List<OPTIONAL_MULTIPLE_CHOICES_SELECTION> CURRENT_CHOICES_LIST
        {
            get
            {
                _cURRENT_CHOICES_LIST = (_cURRENT_CHOICES_LIST == null) ? new List<OPTIONAL_MULTIPLE_CHOICES_SELECTION>() : _cURRENT_CHOICES_LIST;
                return _cURRENT_CHOICES_LIST;
            }
            set
            {
                _cURRENT_CHOICES_LIST = value;
            }
        }

        BLL.WIN.CustomDataTypes.InputDataTypes _sELECTED_DATA_TYPE;
        BLL.WIN.CustomDataTypes.InputDataTypes SELECTED_DATA_TYPE
        { get { return _sELECTED_DATA_TYPE; } set { _sELECTED_DATA_TYPE = value; } }

        private void RESET_ALL_INPUTS()
        {
            ShowMaxLength = false;
            ShowListItemAdjustment = false;
            ShowCountry = false;
            ShowNationality = false;
            ShowNumeric = false;
            ShowDecimal = false;
            ShowText = false;
            ShowDateTime = false;
            ShowBoolean = false;

            CURRENT_CHOICES_LIST = new List<OPTIONAL_MULTIPLE_CHOICES_SELECTION>();
            comboList.Properties.Items.Clear();
            comboDefaultValue.Properties.Items.Clear();
        }

        private void SHOW_DATA_TYPES_CONTROLS(BLL.WIN.CustomDataTypes.InputDataTypes sELECTED_DATA_TYPE)
        {
            SELECTED_DATA_TYPE = sELECTED_DATA_TYPE;
            RESET_ALL_INPUTS();
            switch (SELECTED_DATA_TYPE)
            {
                #region Numeric
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Numeric:
                    ShowNumeric = true;
                    break;
                #endregion
                #region Decimal
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Decimal:
                    {
                        ShowDecimal = true;
                    }
                    break;
                #endregion
                #region TEXT and FREE TEXT
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Text:
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.FreeText:
                    {
                        ShowText = true;
                    }
                    break;
                #endregion
                #region Multi select & Optional Values
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.OptionalValue:
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Multiselect:
                    {
                        CURRENT_CHOICES_LIST = new List<OPTIONAL_MULTIPLE_CHOICES_SELECTION>();
                        ShowListItemAdjustment = true;
                    }
                    break;
                #endregion
                #region True / False
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.TrueFalse:
                    { ShowBoolean = true; }
                    break;
                #endregion
                #region Date
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Date:
                    {
                        chkCurrentDate.Text = "Current date";
                        chkNoDate.Text = "No date";

                        ShowDateTime = true;
                    }
                    break;
                #endregion
                #region Country
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Country:
                    {
                        ShowCountry = true;
                    }
                    break;
                #endregion
                #region Nationality
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Nationality:
                    ShowNationality = true;
                    break;
                #endregion
                #region TIME
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Time:
                    {

                        ShowDateTime = true;
                        chkCurrentDate.Text = "Current time";
                        chkNoDate.Text = "No time";
                    }
                    break;
                #endregion
            }
        }

        public DocumentTypesIndecies()
        {
            InitializeComponent();

            //1. load all data types
            SELECTED_DATA_TYPE = BLL.WIN.CustomDataTypes.InputDataTypes.N_A;
            CURRENT_CHOICES_LIST = new List<OPTIONAL_MULTIPLE_CHOICES_SELECTION>();
            INDEXES_DATA_TYPES = new Dictionary<int, int>();
            comboParametersDataType.Properties.Items.BeginUpdate();
            comboParametersDataType.Properties.Items.Clear();

            int i = 0;

            PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPESLoadAll().ToList().ForEach(new Action<PRO_DOCS.DAL.Database.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPESLoadAllResult>(delegate(PRO_DOCS.DAL.Database.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPESLoadAllResult _sYSTEM_ROLE)
            {
                INDEXES_DATA_TYPES.Add(i, _sYSTEM_ROLE.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPE_ID);
                comboParametersDataType.Properties.Items.Add(_sYSTEM_ROLE.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPES_NAME);
                i++;
            }));

            comboParametersDataType.Properties.Items.EndUpdate();
            comboParametersDataType.SelectedIndex = -1;
            CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX = new DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX();

            //CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE = new DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE();
            //CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE.ARCHIVE_DEPARTMENT_DOCUMNET_TYPE_ID = 11;
            //LOAD_ALL_DOCUMENT_TYPE_DYNAMIC_INDECIES(CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE.ARCHIVE_DEPARTMENT_DOCUMNET_TYPE_ID);

            btnSaveUpdate.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(btnSaveUpdate_ItemClick);
            btnAddNew.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(btnAddNew_ItemClick);
            btnDeleteItem.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(btnDeleteItem_ItemClick);
        }

        void btnDeleteItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (!CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID.Equals(Guid.Empty))
            {
                if (XtraMessageBox.Show("Deleting this index will lead to removing all it's related data.\nAre you sure you want to delete this index?", "Confirm Delete", MessageBoxButtons.OKCancel, MessageBoxIcon.Question).Equals(DialogResult.OK))
                {
                    PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEXESDelete(CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID);

                    gridView1.DeleteSelectedRows();
                }
            }
        }

        void btnAddNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX = new DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX();
            txtInfoDisplayName.Text = string.Empty;
            txtDisplayOrder.Text = (gridView1.RowCount + 1).ToString();
            comboParametersDataType.SelectedIndex = -1;
            RESET_ALL_INPUTS();
        }

        void btnSaveUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            dxErrorProvider1.ClearErrors();

            bool hasDisplayName = !string.IsNullOrEmpty(txtInfoDisplayName.Text);
            bool hasDataType = comboParametersDataType.SelectedIndex > -1;
            if (hasDisplayName && hasDataType)
            {
                SAVE_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX();
            }
            else
            {
                if (!hasDataType)
                {
                    dxErrorProvider1.SetError(comboParametersDataType, BLL.WIN.Properties.ErrorProviderMessages.Default.InputLeftBlank.Replace("{name}", "Datatype"));
                }
                if (!hasDisplayName)
                {
                    dxErrorProvider1.SetError(txtInfoDisplayName, BLL.WIN.Properties.ErrorProviderMessages.Default.InputLeftBlank.Replace("{name}", "Display name"));
                }
            }
        }

        private void chkCurrentDate_CheckedChanged(object sender, EventArgs e)
        {
            switch (SELECTED_DATA_TYPE)
            {
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Date:
                    dtePickerDefaultValue.Visible = !chkCurrentDate.Checked;
                    break;
                case PRO_DOCS.BLL.WIN.CustomDataTypes.InputDataTypes.Time:
                    tmepkrDefaultTimePicker.Visible = !chkCurrentDate.Checked;
                    break;
            }
        }

        private void chkNoDate_CheckedChanged(object sender, EventArgs e)
        {
            chkCurrentDate.Checked = true;
            chkCurrentDate.Visible = !chkNoDate.Checked;
        }

        public Dictionary<int, int> INDEXES_DATA_TYPES { get; set; }

        private void comboParametersDataType_SelectedIndexChanged(object sender, EventArgs e)
        {
            tblDataTypes.Visible = false;
            if (comboParametersDataType.SelectedIndex > -1)
            {
                BLL.WIN.CustomDataTypes.InputDataTypes sELECTED_DATA_TYPE = (BLL.WIN.CustomDataTypes.InputDataTypes)INDEXES_DATA_TYPES[comboParametersDataType.SelectedIndex];
                SHOW_DATA_TYPES_CONTROLS(sELECTED_DATA_TYPE);
                tblDataTypes.Visible = true;
            }
            else
            {

            }
        }

        private void txtTrueFalseValue_EditValueChanged(object sender, EventArgs e)
        {
            int selectedIndex = comboDefaultValue.SelectedIndex;

            comboDefaultValue.Properties.Items.Clear();

            comboDefaultValue.Properties.Items.Add(txtTrueValue.Text);
            comboDefaultValue.Properties.Items.Add(txtFalseValue.Text);

            comboDefaultValue.SelectedIndex = selectedIndex;
        }

        public DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX { get; set; }
        public DAL.Database.ARCHIVE_DOCUMENT_TYPE CURRENT_SELECTED_ARCHIVE_DOCUMENT_TYPE { get; set; }

        private void btnAdjustList_Click(object sender, EventArgs e)
        {
            bool isMultipleSelection = SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Multiselect);
            MultipleSelectionsSetup multipleSelectionsSetup = new MultipleSelectionsSetup(isMultipleSelection);
            multipleSelectionsSetup.CURRENT_CHOICES_LIST = CURRENT_CHOICES_LIST;
            if (multipleSelectionsSetup.ShowDialog().Equals(DialogResult.OK))
            {
                CURRENT_CHOICES_LIST = multipleSelectionsSetup.CURRENT_CHOICES_LIST;
                comboList.Properties.Items.BeginUpdate();
                comboList.Properties.Items.Clear();
                comboDefaultValue.Properties.Items.BeginUpdate();
                comboDefaultValue.Properties.Items.Clear();

                string default_values = string.Empty;

                for (int i = 0; i < CURRENT_CHOICES_LIST.Count; i++)
                {
                    OPTIONAL_MULTIPLE_CHOICES_SELECTION selectionsChoice = CURRENT_CHOICES_LIST[i];

                    comboList.Properties.Items.Add(selectionsChoice.SELECTION_NAME);

                    if (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Multiselect))
                    {
                        if (selectionsChoice.IS_SELECTED)
                        {
                            default_values += (string.IsNullOrEmpty(default_values)) ? selectionsChoice.SELECTION_NAME : ";" + selectionsChoice.SELECTION_NAME;
                        }
                    }
                    else
                    {
                        comboDefaultValue.Properties.Items.Add(selectionsChoice.SELECTION_NAME);
                    }

                }

                comboList.Properties.Items.EndUpdate();
                comboList.SelectedIndex = -1;
                comboDefaultValue.Properties.Items.EndUpdate();
                comboDefaultValue.SelectedIndex = -1;

                txtDefaultValue.Text = default_values;
                comboDefaultValue.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
            }
        }

        private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (e.FocusedRowHandle > -1)
            {
                //1. get the current index
                CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX = gridView1.GetRow(e.FocusedRowHandle) as DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX;

                CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX = (from moreInfo in PRO_DOCSDatabaseDataContext.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEXes
                                                                           where moreInfo.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID.Equals(CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID)
                                                                           select moreInfo).FirstOrDefault();

                if (!CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID.Equals(Guid.Empty))
                {
                    comboParametersDataType.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPE.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPES_NAME;//.SelectedIndex = dATA_TYPE.Key;
                    LOAD_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX();
                }
            }
        }

        private void SAVE_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX()
        {

            Guid aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID = Guid.NewGuid();
            if (CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID.Equals(Guid.Empty))
            {
                CurrentRecordStatus = RecordStatus.New;
                PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEXESInsert
                    (aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID,
                    CURRENT_SELECTED_ARCHIVE_DOCUMENT_TYPE.ARCHIVE_DOCUMENT_TYPE_ID,
                    null,
                    string.Empty,
                    0,
                    string.Empty,
                    0,
                    false,
                    false);

            }
            else
            {
                CurrentRecordStatus = RecordStatus.Old;

                aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID;
            }

            CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX = (from index in PRO_DOCSDatabaseDataContext.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEXes
                                                                       where index.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID.Equals(aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID)
                                                                       select index).FirstOrDefault();

            CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_IS_REQUIRED = chkIsRequired.Checked;
            CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPE_ID = Convert.ToInt32(SELECTED_DATA_TYPE);
            CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DISPLAY_NAME = txtInfoDisplayName.Text;
            CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DISPLAY_ORDER = Convert.ToInt32(txtDisplayOrder.Text);
            switch (SELECTED_DATA_TYPE)
            {
                #region Numeric / Decimal
                case BLL.WIN.CustomDataTypes.InputDataTypes.Numeric:
                case BLL.WIN.CustomDataTypes.InputDataTypes.Decimal:
                    {
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE = numericDefaultValue.Value.ToString();
                    }
                    break;
                #endregion

                #region Text / Free Text
                case BLL.WIN.CustomDataTypes.InputDataTypes.Text:
                case BLL.WIN.CustomDataTypes.InputDataTypes.FreeText:
                    {
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE = txtDefaultValue.Text;
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_MAX_LENGTH = (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.FreeText)) ? 0 : Convert.ToInt32(txtMaxLength.Text);

                    }
                    break;
                #endregion

                #region Multiselect / OptionalValue

                case BLL.WIN.CustomDataTypes.InputDataTypes.Multiselect:
                case BLL.WIN.CustomDataTypes.InputDataTypes.OptionalValue:
                    {
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE =
                            (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.OptionalValue)) ?
                            comboDefaultValue.Text : txtDefaultValue.Text;

                        PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONSDeleteByARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID(CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID);

                        //add the selected Items
                        for (int i = 0; i < CURRENT_CHOICES_LIST.Count; i++)
                        {
                            long? selectionId = 0;
                            PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONSInsert//.proc_AssetCategoriesMoreInfoMultiSelectionInsert
                                (
                                    ref selectionId,
                                    CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID,
                                    CURRENT_CHOICES_LIST[i].SELECTION_NAME,
                                    i + 1
                                 );
                        }
                    }
                    break;
                #endregion

                #region True / False
                case BLL.WIN.CustomDataTypes.InputDataTypes.TrueFalse:
                    {
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE = comboDefaultValue.Text;

                        string trueValue = txtTrueValue.Text;
                        string falseValue = txtFalseValue.Text;

                        PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_BIT_OPTIONSInsert
                            (
                                 CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID,
                                 trueValue,
                                 falseValue
                            );

                    }
                    break;
                #endregion

                #region Country / Nationality
                case BLL.WIN.CustomDataTypes.InputDataTypes.Country:
                case BLL.WIN.CustomDataTypes.InputDataTypes.Nationality:
                    {
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE = comboDefaultValue.Text;
                    }
                    break;
                #endregion

                #region Date / Time
                case BLL.WIN.CustomDataTypes.InputDataTypes.Date:
                case BLL.WIN.CustomDataTypes.InputDataTypes.Time:
                    {
                        string default_value = string.Empty;
                        if (!chkNoDate.Checked)
                        {
                            if (chkCurrentDate.Checked)
                            {
                                default_value = "GETDATE";
                            }
                            else
                            {
                                if (SELECTED_DATA_TYPE.Equals(BLL.WIN.CustomDataTypes.InputDataTypes.Date))
                                {
                                    int day = dtePickerDefaultValue.DateTime.Day;
                                    int month = dtePickerDefaultValue.DateTime.Month;
                                    int year = dtePickerDefaultValue.DateTime.Year;

                                    default_value = string.Format("{0}-{1}-{2}", day, month, year);
                                }
                                else
                                {
                                    default_value = tmepkrDefaultTimePicker.Text;
                                }

                            }
                        }
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE = default_value;
                    }
                    break;
                #endregion
            }

            PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEXESUpdate
                    (
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_ID,
                        CURRENT_SELECTED_ARCHIVE_DOCUMENT_TYPE.ARCHIVE_DOCUMENT_TYPE_ID,
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DATA_TYPE_ID.Value,
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DISPLAY_NAME,
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_MAX_LENGTH,
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE,
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DISPLAY_ORDER.Value,
                        CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_IS_REQUIRED.Value,
                        false
                    );

            switch (CurrentRecordStatus)
            {
                case RecordStatus.New:
                    {
                        LOAD_ALL_DOCUMENT_TYPE_DYNAMIC_INDECIES(CURRENT_SELECTED_ARCHIVE_DOCUMENT_TYPE.ARCHIVE_DOCUMENT_TYPE_ID);
                    }
                    break;
                case RecordStatus.Old:
                    {
                        gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gcIsRequired, chkIsRequired.Checked);
                        gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gcDisplayOrder, txtDisplayOrder.Value);
                        gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gcDisplayName, txtInfoDisplayName.Text);
                        gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gcDefaultValue, CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE);
                        gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gcDataType, comboParametersDataType.Text);
                    }
                    break;
            }

            CurrentRecordStatus = RecordStatus.Old;

        }

        /// <summary>
        /// Loads the file archive more info item.
        /// </summary>
        private void LOAD_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX()
        {


            //set the more info item detail
            txtInfoDisplayName.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DISPLAY_NAME;

            chkIsRequired.Checked = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_IS_REQUIRED.Value;

            txtDisplayOrder.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DISPLAY_ORDER.Value.ToString();

            switch (SELECTED_DATA_TYPE)
            {
                #region Numeric / Decimal
                case BLL.WIN.CustomDataTypes.InputDataTypes.Numeric:
                case BLL.WIN.CustomDataTypes.InputDataTypes.Decimal:
                    numericDefaultValue.Text = (string.IsNullOrEmpty(CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE)) ? "0" : CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
                    break;
                #endregion

                #region FreeText / Text
                case BLL.WIN.CustomDataTypes.InputDataTypes.Text:
                    txtMaxLength.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_MAX_LENGTH.Value.ToString();
                    txtDefaultValue.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
                    break;
                case BLL.WIN.CustomDataTypes.InputDataTypes.FreeText:
                    txtDefaultValue.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
                    break;
                #endregion

                #region Optional Values / Multiselect
                case BLL.WIN.CustomDataTypes.InputDataTypes.OptionalValue:
                    {
                        List<DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION> aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONs.ToList();

                        CURRENT_CHOICES_LIST = new List<OPTIONAL_MULTIPLE_CHOICES_SELECTION>();
                        comboList.Properties.Items.BeginUpdate();
                        comboList.Properties.Items.Clear();
                        comboDefaultValue.Properties.Items.BeginUpdate();
                        comboDefaultValue.Properties.Items.Clear();

                        for (int i = 0; i < aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS.Count; i++)
                        {
                            OPTIONAL_MULTIPLE_CHOICES_SELECTION selectionsChoice = new OPTIONAL_MULTIPLE_CHOICES_SELECTION();
                            selectionsChoice.IS_SELECTED = false;
                            selectionsChoice.SELECTION_NAME = aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS[i].ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION_NAME;
                            CURRENT_CHOICES_LIST.Add(selectionsChoice);
                            comboList.Properties.Items.Add(aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS[i].ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION_NAME);
                            comboDefaultValue.Properties.Items.Add(aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS[i].ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION_NAME);
                        }

                        comboList.Properties.Items.EndUpdate();
                        comboList.SelectedIndex = -1;
                        comboDefaultValue.Properties.Items.EndUpdate();
                        comboDefaultValue.SelectedIndex = -1;
                        comboDefaultValue.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;

                    }
                    break;
                case BLL.WIN.CustomDataTypes.InputDataTypes.Multiselect:
                    {
                        List<DAL.Database.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION> aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONs.ToList();

                        CURRENT_CHOICES_LIST = new List<OPTIONAL_MULTIPLE_CHOICES_SELECTION>();
                        comboList.Properties.Items.BeginUpdate();
                        comboList.Properties.Items.Clear();

                        List<string> default_selections = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE.Split(';').ToList();

                        for (int i = 0; i < aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS.Count; i++)
                        {
                            OPTIONAL_MULTIPLE_CHOICES_SELECTION selectionsChoice = new OPTIONAL_MULTIPLE_CHOICES_SELECTION();
                            selectionsChoice.IS_SELECTED = default_selections.Contains(aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS[i].ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION_NAME);
                            selectionsChoice.SELECTION_NAME = aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS[i].ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION_NAME;
                            CURRENT_CHOICES_LIST.Add(selectionsChoice);
                            comboList.Properties.Items.Add(aRCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTIONS[i].ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_LIST_OPTION_NAME);
                        }

                        txtDefaultValue.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
                    }
                    break;
                #endregion

                #region True / False
                case BLL.WIN.CustomDataTypes.InputDataTypes.TrueFalse:
                    txtTrueValue.Text = (CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_BIT_OPTION == null) ? "True" : CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_BIT_OPTION.BIT_OPTION_TRUE_DISPLAY_NAME;
                    txtFalseValue.Text = (CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_BIT_OPTION == null) ? "False" : CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_BIT_OPTION.BIT_OPTION_FALSE_DISPLAY_NAME;

                    comboDefaultValue.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
                    break;
                #endregion

                #region Date / Time
                case BLL.WIN.CustomDataTypes.InputDataTypes.Date:
                    if (String.IsNullOrEmpty(CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE))
                    {
                        chkNoDate.Checked = true;
                    }
                    else if (CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE.Equals("GETDATE"))
                    {
                        chkNoDate.Checked = false;
                        chkCurrentDate.Checked = true;
                    }
                    else
                    {
                        List<string> current_default_string = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE.Split('-').ToList();
                        int day = Convert.ToInt32(current_default_string[0]);
                        int month = Convert.ToInt32(current_default_string[1]);
                        int year = Convert.ToInt32(current_default_string[2]);
                        DateTime datetimePickerValue = new DateTime(year, month, day);
                        dtePickerDefaultValue.DateTime = datetimePickerValue;
                    }
                    break;
                case BLL.WIN.CustomDataTypes.InputDataTypes.Time:
                    if (String.IsNullOrEmpty(CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE))
                    {
                        chkNoDate.Checked = true;
                    }
                    else if (CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE.Equals("GETDATE"))
                    {
                        chkNoDate.Checked = false;
                        chkCurrentDate.Checked = true;
                    }
                    else
                    {
                        tmepkrDefaultTimePicker.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
                    }
                    break;
                #endregion

                #region Country / Nationality
                case BLL.WIN.CustomDataTypes.InputDataTypes.Country:
                case BLL.WIN.CustomDataTypes.InputDataTypes.Nationality:
                    comboDefaultValue.Text = CURRENT_SELECTED_ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX.ARCHIVE_DEPARTMENT_DOCUMENT_TYPE_INDEX_DEFAULT_VALUE;
                    break;
                #endregion
            }
        }

        private void comboList_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void DocumentTypesIndecies_Load(object sender, EventArgs e)
        {

        }
    }
}
